//
//  IceScoreCell.m
//  WuJieLive
//
//  Created by 张瀚坤 on 2017/11/10.
//  Copyright © 2017年 zhk. All rights reserved.
//

#import "IceScoreCell.h"

@implementation IceScoreCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.bgView.layer.masksToBounds = YES;
    self.bgView.layer.cornerRadius = 10;
    self.lineImage.image = [self drawLineOfDashByImageView:self.lineImage];
}

- (UIImage *)drawLineOfDashByImageView:(UIImageView *)imageView {
    
    // 开始划线 划线的frame
    UIGraphicsBeginImageContext(CGSizeMake(kScreenWidth, 1));
    
    [imageView.image drawInRect:CGRectMake(0, 0, kScreenWidth, 1)];
    
    // 获取上下文
    CGContextRef line = UIGraphicsGetCurrentContext();
    
    // 设置线条终点的形状
    CGContextSetLineCap(line, kCGLineCapRound);
    // 设置虚线的长度 和 间距
    CGFloat lengths[] = {5,3};
    
    CGContextSetStrokeColorWithColor(line, TextLessImportColor.CGColor);
    // 开始绘制虚线
    CGContextSetLineDash(line, 0, lengths, 2);
    
    CGContextMoveToPoint(line, 0, 0);
    
    CGContextAddLineToPoint(line, kScreenWidth, 0);
    
    CGContextStrokePath(line);
    
    // UIGraphicsGetImageFromCurrentImageContext()返回的就是image
    return UIGraphicsGetImageFromCurrentImageContext();
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
